A mobile device can detect geofences. A geofence is a virtual perimeter around a real world geographic area. The mobile device can determine when it enters or exits a geofence by constantly comparing the mobile device's current location to the location of the geofence.
Generally, to obtain a current location, a mobile device can use data based on three various sources: 1) WiFi hotspots, 2) cellular towers, or 3) a Global Positioning System (GPS). Obtaining a location from these three sources require differing amounts of battery consumption. For example, finding the current location through WiFi hotspots is less battery intensive than finding the current location through a GPS. In the case of detecting geofences, to save battery, the mobile device attempts to obtain the current location first through WiFi hotspot data, then cellular tower data, and finally GPS signal data.